<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/11/29/029
 * Time: 22:29
 */

namespace App\Services\shop;


use App\Models\barber\Barber;

class BarberService
{
    public function getCate($shop_id = 0):array
    {
        $map = [];
        if ($shop_id){
            $map['shop_id'] = $shop_id;
        }

        return array_pluck(Barber::select('id','name')->where($map)->get()->toArray(), 'name','id');
    }

    public static function getCate1($shop_id = 0):array
    {
        $map = [];
        if ($shop_id){
            $map['shop_id'] = $shop_id;
        }

        return array_pluck(Barber::select('id','name')->where($map)->get()->toArray(), 'name','id');
    }

    public static function api($shop_id = 0)
    {
        $map = [];
        if ($shop_id){
            $map['shop_id'] = $shop_id;
        }
        return Barber::select('id','name as text')->where($map)->get()->toArray();
    }

}